/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 *  \file     Mbox_Ip.h                                                                                 *
 *  \brief    This file contains interface header for maibox low level driver                           *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2024/11/07     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/
#ifndef MBOX_IP_H
#define MBOX_IP_H

#include "lld_platform.h"
#include "mbox_proc.h"

/********************************************************************************************************
 *                                 Private Macro definition                                             *
 *******************************************************************************************************/
/** \brief  mailbox registers offset */
#define MBOX_TMH0                  0x0U
#define MBOX_TMH0_MDP              0x4U
#define MBOX_TMH1                  0x8U
#define MBOX_TMH2                  0xcU
#define MBOX_TMC(id)               (0x10U + ((id) * 0x8U))
#define MBOX_TMC_WAKEUP(id)        (0x14U + ((id) * 0x8U))

#define MBOX_TMS                   0x30U
#define MBOX_TPWES                 0x40U

#define MBOX_RMC                   0x44U
#define MBOX_RWC                   0x54U
#define MBOX_RWM                   0x58U
#define MBOX_TACK_INT_EN           0x5CU

#define MBOX_RMH(id, n, m)         ((0x60U + ((id) * 0x4U)) + ((m) * 0xcU) + ((n) * 0x30U))
#define MBOX_MASTERID(id)          (0xC00U + ((id) * 0x4U))

#define MBOX_WAKEUP_SRC            0xB10U
#define MBOX_WAKEUP_MSG            0xB14U
#define MBOX_CPUUSERID             0xC80U

/** \brief Support 4 Hardware Channel */
#define MBOX_MSG_NUM               4U
/** \brief Max Support 10 Cores */
#define MBOX_PROC_NUM              10U

/** \brief Transmit Message Header0 Register */
#define MBOX_TMH0_MID_SHIFT        24U
#define MBOX_TMH0_LEN_SHIFT        0U

/** \brief Transmit Message Control Register */
#define MBOX_TMC_CANCEL_STATUS_SHIFT 9U
#define MBOX_TMC_CANCEL_SHIFT      8U
#define MBOX_TMC_SEND_SHIFT        0U

/** \brief Receive Message Header0 Register */
#define MBOX_RMH0_LEN_MASK         0x7ffU

/********************************************************************************************************
 *                                 Global Macro definition                                              *
 *******************************************************************************************************/
/** \brief  mailbox send no wait */
#define MBOX_SEND_NOWAIT    0U

/********************************************************************************************************
 *                                  Global Types definition                                             *
 *******************************************************************************************************/
/** \brief receive callback function */
typedef void (*Mbox_RecvCallback)(uint16_t srcProcId, uint64_t msg, uint16_t len, void *arg);

/** \brief wakeup callback function */
typedef void (*Mbox_WakeUpCallback)(uint16_t srcProcId, uint32_t msg, void *arg);

/** \brief mailbox channel status */
typedef enum
{
    /** no error */
    MBOX_OK = 0U,
    /** timeout error */
    MBOX_ERR_TIMEOUT = 1U,
    /** invalid master id */
    MBOX_ERR_INVALID_MASTERID = 2U,
    /* PRQA S 1535 EOF */
} Mbox_Ip_ChnStatusType;

/** \brief mailbox acknowledge mode */
typedef enum {
    /** poll mode */
    MBOX_ACK_POLL_MODE = 0x0U,
    /** interrupt mode */
    MBOX_ACK_INTERRUPT_MODE = 0x1U,
} Mbox_Ip_AckModeType;

/** \brief  Structure defining mailbox channel */
typedef struct
{
    /** mailbox register base */
    uint32_t base;
    /** the target core mask */
    uint16_t mdp;
    /** the message id */
    uint8_t msgId;
    /** receive callback function */
    Mbox_RecvCallback cbFunc;
    /** receive callback function param */
    void *recvArg;
    /** wakeup callback function */
    Mbox_WakeUpCallback wakeupCbFunc;
    /** wakeup callback function param */
    void *wakeupArg;
    /** ack mode */
    uint8_t ackMode;
    /** current channel is active */
    volatile bool isActive;
    /** ack status */
    volatile bool ackStatus;
    /** reserved */
    void *priv;
} Mbox_Ip_ChnCfgType;

/********************************************************************************************************
 *                                  Private Function Declarations                                       *
 *******************************************************************************************************/
/** *****************************************************************************************************
 * \brief This function sets the master id for mailbox.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_SetMasterId(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Set the master id for mailbox.
 *******************************************************************************************************/
void Mbox_Ip_SetMasterId(uint32_t base);

/** *****************************************************************************************************
 * \brief This function gets the master id of mailbox.
 *
 * \verbatim
 * Syntax             : uint16_t Mbox_Ip_GetMasterId(uint16_t procId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : procId - the mailbox port number
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : The master id of mailbox
 *
 * Description        : Get the master id of mailbox.
 * \endverbatim
 *******************************************************************************************************/
uint16_t Mbox_Ip_GetMasterId(uint16_t procId);

/** *****************************************************************************************************
 * \brief This function gets the cpu user id of mailbox.
 *
 * \verbatim
 * Syntax             : uint16_t Mbox_Ip_GetCpuUserId(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : The cpu user id of mailbox
 *
 * Description        : Get the cpu user id of mailbox.
 * \endverbatim
 *******************************************************************************************************/
uint16_t Mbox_Ip_GetCpuUserId(uint32_t base);

/** *****************************************************************************************************
 * \brief This function checks if the master id is valid.
 *
 * \verbatim
 * Syntax             : int32_t Mbox_Ip_CheckMasterId(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : The result of the check
 *
 * Description        : Check if the master id is valid.
 * \endverbatim
 *******************************************************************************************************/
int32_t Mbox_Ip_CheckMasterId(uint32_t base);

/** *****************************************************************************************************
 * \brief This function fills the mailbox message header.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_FillMsgHeader(uint32_t base,
 *                          uint8_t msgId, uint16_t mdp, uint16_t len)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msgId - the message id
 *                    : mdp - the target core mask
 *                    : len - the length of the message
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Fill the mailbox message header.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_FillMsgHeader(uint32_t base, uint8_t msgId, uint16_t mdp, uint16_t len);

/** *****************************************************************************************************
 * \brief This function fills the short message.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_FillShortMsg(uint32_t base, uint64_t msg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msg - the short message
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Fill the short message.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_FillShortMsg(uint32_t base, uint64_t msg);

/** *****************************************************************************************************
 * \brief This function starts transmission.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_Send(uint32_t base, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Start transmission.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_Send(uint32_t base, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function gets the transmission status.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_TxDone(uint32_t base, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Transmission status
 *
 * Description        : Get the transmission status.
 * \endverbatim
 *******************************************************************************************************/
bool Mbox_Ip_TxDone(uint32_t base, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function cancel transmission.
 * \verbatim
 * Syntax             : void Mbox_Ip_CancelSend(uint32_t base, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Cancel the message sent.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_CancelSend(uint32_t base, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function gets the cancel status.
 *
 * \verbatim
 * Syntax             : bool Mbox_Ip_CancelDone(uint32_t base, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Cancel status
 *
 * Description        : Get the cancel status.
 * \endverbatim
 *******************************************************************************************************/
bool Mbox_Ip_CancelDone(uint32_t base, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function Fills the wakeup message.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_FillWakeUpMsg(uint32_t base, uint32_t msg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msg - wakeup message
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Fill the wakeup message.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_FillWakeUpMsg(uint32_t base, uint32_t msg);

/** *****************************************************************************************************
 * \brief This function gets the wakeup source.
 *
 * \verbatim
 * Syntax             : uint32_t Mbox_Ip_GetWakeUpSrc(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Wakeup source
 *
 * Description        : Get the wakeup source.
 * \endverbatim
 *******************************************************************************************************/
uint32_t Mbox_Ip_GetWakeUpSrc(uint32_t base);

/** *****************************************************************************************************
 * \brief This function gets the wakeup message.
 *
 * \verbatim
 * Syntax             : uint32_t Mbox_Ip_GetWakeUpMsg(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Wakeup message
 *
 * Description        : Get the wakeup message.
 * \endverbatim
 *******************************************************************************************************/
uint32_t Mbox_Ip_GetWakeUpMsg(uint32_t base);

/** *****************************************************************************************************
 * \brief This function sends wakeup request.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_SendWakeUp(uint32_t base, uint8_t msgId, uint16_t mdp)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : msgId - the message id
 *                    : mdp - the target core mask
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Send wakeup request.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_SendWakeUp(uint32_t base, uint8_t msgId, uint16_t mdp);

/** *****************************************************************************************************
 * \brief This function gets wakeup status.
 *
 * \verbatim
 * Syntax             : bool Mbox_Ip_WakeUpDone(uint32_t base, uint16_t mdp)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : mdp - the target core mask
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Wakeup status
 *
 * Description        : Get wakeup status.
 * \endverbatim
 *******************************************************************************************************/
bool Mbox_Ip_WakeUpDone(uint32_t base, uint16_t mdp);

/** *****************************************************************************************************
 * \brief This function acknowledges mailbox wakeup.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_AckWakeUp(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Acknowledge mailbox wakeup.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_AckWakeUp(uint32_t base);

/** *****************************************************************************************************
 * \brief This function gets the received message source.
 *
 * \verbatim
 * Syntax             : uint64_t Mbox_Ip_Get_Status(uint32_t base)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : The received message source
 *
 * Description        : Get the received message source.
 * \endverbatim
 *******************************************************************************************************/
uint64_t Mbox_Ip_GetStatus(uint32_t base);

/** *****************************************************************************************************
 * \brief This function acknowledges mailbox message.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_Ack(uint32_t base, uint16_t procId, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : procId - the target core id
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Acknowledge mailbox message
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_Ack(uint32_t base, uint16_t procId, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function enables/disable ack interrupt.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_EnableAckInterrupt(uint32_t base, bool en)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : en - 1:enable,0:disable
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Enable/disable ack interrupt.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_EnableAckInterrupt(uint32_t base, bool en);

/** *****************************************************************************************************
 * \brief This function gets short message.
 *
 * \verbatim
 * Syntax             : uint64_t Mbox_Ip_GetShortMsg(uint32_t base, uint16_t procId, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : procId - the target core id
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Short message
 *
 * Description        : Get short message.
 * \endverbatim
 *******************************************************************************************************/
uint64_t Mbox_Ip_GetShortMsg(uint32_t base, uint16_t procId, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function gets message length.
 *
 * \verbatim
 * Syntax             : uint16_t Mbox_Ip_GetMsgLength(uint32_t base, uint16_t procId, uint8_t msgId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - the base physical address
 *                    : procId - the target core id
 *                    : msgId - the message id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Message length
 *
 * Description        : Get message length.
 * \endverbatim
 *******************************************************************************************************/
uint16_t Mbox_Ip_GetMsgLength(uint32_t base, uint16_t procId, uint8_t msgId);

/** *****************************************************************************************************
 * \brief This function checks if the transmission is over .
 *
 * \verbatim
 * Syntax             : bool Mbox_Ip_CheckTxDone(const Mbox_Ip_ChnCfgType *chnCfg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : the transmission status
 *
 * Description        : Check the transmission status.
 * \endverbatim
 *******************************************************************************************************/
bool Mbox_Ip_CheckTxDone(const Mbox_Ip_ChnCfgType *chnCfg);

/** *****************************************************************************************************
 * \brief This function set the transmission is over when ack mode is interrupt.
 *
 * \verbatim
 * Syntax             : bool Mbox_Ip_SetTxDone(Mbox_Ip_ChnCfgType *chnCfg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : the transmission status
 *
 * Description        : Set the transmission is over.
 * \endverbatim
 *******************************************************************************************************/
bool Mbox_Ip_SetTxDone(Mbox_Ip_ChnCfgType *chnCfg);

/** *****************************************************************************************************
 * \brief This function waits the message transfer done.
 *
 * \verbatim
 * Syntax             : int32_t Mbox_Ip_WaitTxDone(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t timeOut)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *                    : timeOut - timeout value (ms)
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : the transmission status
 *
 * Description        : Wait the message transfer done.
 * \endverbatim
 *******************************************************************************************************/
int32_t Mbox_Ip_WaitTxDone(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t timeOut);

/** *****************************************************************************************************
 * \brief This function waits the message cancel done.
 *
 * \verbatim
 * Syntax             : int32_t Mbox_Ip_WaitCancelDone(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t timeOut)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *                    : timeOut - timeout value (ms)
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Cancel status
 *
 * Description        : Wait the message cancel done.
 * \endverbatim
 *******************************************************************************************************/
int32_t Mbox_Ip_WaitCancelDone(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t timeOut);

/** *****************************************************************************************************
 * \brief This function waits wakeup done.
 *
 * \verbatim
 * Syntax             : int32_t Mbox_Ip_WaitWakeUpDone(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t timeOut)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *                    : timeOut - timeout value (ms)
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : wakeup status
 *
 * Description        : Wait wakeup done.
 * \endverbatim
 *******************************************************************************************************/
int32_t Mbox_Ip_WaitWakeUpDone(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t timeOut);

/** *****************************************************************************************************
 * \brief This function sends the message.
 *
 * \verbatim
 * Syntax             : int32_t Mbox_Ip_SendMsg(Mbox_Ip_ChnCfgType *chnCfg, uint64_t msg,
 *                                          uint16_t len, uint32_t timeOut)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *                    : msg - the message
 *                    : len - message length
 *                    : timeOut - timeout value (ms)
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Cancel status
 *
 * Description        : Wait the message cancel done.
 * \endverbatim
 *******************************************************************************************************/
int32_t Mbox_Ip_SendMsg(Mbox_Ip_ChnCfgType *chnCfg, uint64_t msg, uint16_t len, uint32_t timeOut);

/** *****************************************************************************************************
 * \brief This function receives the message.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_RecvMsg(const Mbox_Ip_ChnCfgType *chnCfg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Receive the message.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_RecvMsg(const Mbox_Ip_ChnCfgType *chnCfg);

/** *****************************************************************************************************
 * \brief This function wakeups the target core.
 *
 * \verbatim
 * Syntax             : int32_t Mbox_Ip_WakeUp(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t msg, uint32_t timeOut)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *                    : msg - the wakeup message
 *                    : timeOut - timeout value (ms)
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : wakeup status
 *
 * Description        : Wakeup the target core.
 * \endverbatim
 *******************************************************************************************************/
int32_t Mbox_Ip_WakeUp(const Mbox_Ip_ChnCfgType *chnCfg, uint32_t msg, uint32_t timeOut);

/** *****************************************************************************************************
 * \brief This function handles the wakeup request.
 *
 * \verbatim
 * Syntax             : void Mbox_Ip_HandleWakeUp(const Mbox_Ip_ChnCfgType *chnCfg)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : chnCfg - the channel configuration
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Handle the wakeup.
 * \endverbatim
 *******************************************************************************************************/
void Mbox_Ip_HandleWakeUp(const Mbox_Ip_ChnCfgType *chnCfg);

#endif /* MBOX_IP_H */
/* End of file */
